﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Googler.BLL;
using System.Threading;
using System.Net;

namespace HodhodNews.Web
{
    public class KeepAliveWorker
    {
        public static void KeepWebAppAlive(string url)
        {
            var startedAt = Sessions.AppStartedAt;

            if (startedAt == DateTime.MinValue)
            {
                Sessions.AppStartedAt = DateTime.Now;
            }


            int second = 1000;
            int minute = second * 60;
            Thread.Sleep(minute * 1);

            HttpContext.Current.Response.Write("Hodhod news is fine, thanks for asking, I'm now calling my neighbor site to ensure he is still alive");
            
                new WebClient().DownloadString(url);
            

        }
    }
}